#include<iostream>
#include "list.h"
using namespace std;

void reverse_list(LinkList &phead){
    LNode *prev,*cur,*next;
    if(phead == NULL || phead->next == NULL)
        return;
    prev = phead;
    cur = prev->next;
    prev->next = NULL;
    while(cur){
        next =  cur->next;
        cur->next = prev;
        prev = cur;
        cur = next;
    }
    phead = prev;
}

int main(){
    LinkList head;
    create_list(&head,1,5);
    reverse_list(head);
    print_linklist(head);
    return 0;
}

